// <copyright file="ICategoryService.cs" company="EnterpriseApi">
// Copyright (c) EnterpriseApi. All rights reserved.
// </copyright>

using EnterpriseApi.Models;

namespace EnterpriseApi.Services;

/// <summary>
/// 类别服务接口，定义类别特有的业务逻辑操作
/// </summary>
public interface ICategoryService : IService<Category>
{
    /// <summary>
    /// 根据类别名称获取类别
    /// </summary>
    /// <param name="name">类别名称</param>
    /// <returns>类别对象，如果不存在则返回null</returns>
    Task<Category?> GetByNameAsync(string name);

    /// <summary>
    /// 检查类别名称是否已存在
    /// </summary>
    /// <param name="name">类别名称</param>
    /// <returns>类别名称是否已存在</returns>
    Task<bool> IsNameExistsAsync(string name);

    /// <summary>
    /// 创建新类别
    /// </summary>
    /// <param name="category">类别信息</param>
    /// <returns>创建的类别</returns>
    Task<Category> CreateCategoryAsync(Category category);
}